<template>
  <div class="row justify-content-center">
    <div class="col-8">
      <form name="editForm" role="form" novalidate v-on:submit.prevent="save()">
        <h2 id="roomAdminApp.roomUserPermission.home.createOrEditLabel" data-cy="RoomUserPermissionCreateUpdateHeading">
          Create or edit a RoomUserPermission
        </h2>
        <div>
          <div class="form-group" v-if="roomUserPermission.id">
            <label for="id">ID</label>
            <input type="text" class="form-control" id="id" name="id" v-model="roomUserPermission.id" readonly />
          </div>
          <div class="form-group">
            <label class="form-control-label" for="room-user-permission-perm">Perm</label>
            <input
              type="text"
              class="form-control"
              name="perm"
              id="room-user-permission-perm"
              data-cy="perm"
              :class="{ valid: !$v.roomUserPermission.perm.$invalid, invalid: $v.roomUserPermission.perm.$invalid }"
              v-model="$v.roomUserPermission.perm.$model"
            />
            <div v-if="$v.roomUserPermission.perm.$anyDirty && $v.roomUserPermission.perm.$invalid">
              <small class="form-text text-danger" v-if="!$v.roomUserPermission.perm.maxLength">
                This field cannot be longer than 32 characters.
              </small>
            </div>
          </div>
        </div>
        <div>
          <button type="button" id="cancel-save" data-cy="entityCreateCancelButton" class="btn btn-secondary" v-on:click="previousState()">
            <font-awesome-icon icon="ban"></font-awesome-icon>&nbsp;<span>Cancel</span>
          </button>
          <button
            type="submit"
            id="save-entity"
            data-cy="entityCreateSaveButton"
            :disabled="$v.roomUserPermission.$invalid || isSaving"
            class="btn btn-primary"
          >
            <font-awesome-icon icon="save"></font-awesome-icon>&nbsp;<span>Save</span>
          </button>
        </div>
      </form>
    </div>
  </div>
</template>
<script lang="ts" src="./room-user-permission-update.component.ts"></script>
